﻿using System.Collections.Generic;
using System.Linq;
using TeaLight.Core.BL.Entities;
using TeaLight.DL.SQLite;

namespace TeaLight.Core.DAL
{
    public partial class SessionRepository
    {
        public static IEnumerable<Speaker> GetSpeakers(Session session)
        {
            return (from r in
                        (from r in SessionSpeakerRepository.GetTable()
                         where r.SessionId == session.Id
                         group r by r.SpeakerId)
                    join re in SpeakerRepository.GetTable() on r.Key equals re.Id
                    orderby re.Name
                    select re);
        }
    }
}

